import java.security.NoSuchAlgorithmException;

public class Main {

        public static void main(String[] args) throws NoSuchAlgorithmException {
            // 从命令行输入的路径名读取对应的文件，将文件的内容转化为对应的字符串
            String path1 = "C:\\Users\\26913\\Desktop\\demo\\src\\main\\resources\\str0.txt";
            String path2 = "C:\\Users\\26913\\Desktop\\demo\\src\\main\\resources\\str1.txt";
            String str0 = TextIoUtil.readTxt(path1);
            String str1 = TextIoUtil.readTxt(path2);
            String pathRes = "C:\\Users\\26913\\Desktop\\demo\\src\\main\\resources\\res.txt";
            // 由字符串得出对应的 simHash值
            String simHash0 = SimHashUtil.getSimHash(str0);
            String simHash1 = SimHashUtil.getSimHash(str1);
            // 由 simHash值求出相似度
            double similarity = SimHashUtil.getSimilarity(simHash0, simHash1);
            // 把相似度写入最后的结果文件中
            TextIoUtil.writeTxt(similarity, pathRes);
            // 退出程序
            System.exit(0);

    }
}
